<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="../static/layui/layui-v2.9.7/layui/css/layui.css">
  <script src="../static/layui/layui-v2.9.7/layui/layui.js"></script>
  <script src="../static/jquery/main.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>

  <style>
    adminstudentform{
      display: flex !important;
     
    }
    #username{
      margin-left: 30px;
      width: 200px !important;
    }
    .Course form input{
      width: 200px !important;
    }
  </style>
</head>

<body>
  <div class="layui-layout layui-layout-admin">
    <div class="layui-header">
      <div class="layui-logo layui-hide-xs layui-bg-black">teacher</div>
      <!-- 头部区域（可配合layui 已有的水平导航） -->
      <ul class="layui-nav layui-layout-left">

        <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
          <i class="layui-icon layui-icon-spread-left"></i>
        </li>


      </ul>
      <ul class="layui-nav layui-layout-right">

        <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
          <a href="javascript:;">
            <img src="//unpkg.com/outeres@0.0.10/img/layui/icon-v2.png" class="layui-nav-img">
            {{username}}
          </a>
          <dl class="layui-nav-child">

            <dd><a href="javascript:;" id="loginout">退出登录</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
          <a href="javascript:;">
            <i class="layui-icon layui-icon-more-vertical"></i>
          </a>
        </li>
      </ul>
    </div>
    <div class="layui-side layui-bg-black">
      <div class="layui-side-scroll">
        <!-- 左侧导航区域（可Fstudent配合layui已有的垂直导航） -->
        <ul class="layui-nav layui-nav-tree" lay-filter="test">
          <li class="layui-nav-item layui-this"><a href="javascript:;" id="index">系统首页</a></li>
          <li class="layui-nav-item "><a href="javascript:;" id="course">我的上课安排</a></li>
          <li class="layui-nav-item "><a href="javascript:;" id="students">学生信息查询</a></li>
        </ul>
      </div>
    </div>
    <div class="layui-body">
      <!-- 内容主体区域 -->
      <div style="padding: 15px;" class="index">
        <blockquote class="layui-elem-quote layui-text">
         主页
        </blockquote>
        
        <div class="layui-card layui-panel">
          <canvas id="echmap" width="600" height="400"></canvas>
          <canvas id="chart" width="600" height="400"></canvas>
          <div id="coursenumber" style="width: 800px; height: 600px;"></div>
        </div>
        <br><br>
      </div>
      <div style="padding: 15px; display: none;" class="course">
        <blockquote class="layui-elem-quote layui-text">
         上课信息管理
        </blockquote>
        
        <div class="layui-card layui-panel">
            <table class="layui-table">
              <colgroup>
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <thead>
                    <th>序号</th>
                    <th>课程名称</th>
                    <th>班级</th>
                    <th>学院</th>
                    <th>记录时间</th>
                </thead>
                <tbody>
                  
                </tbody>
            </table>

        </div>
        <br><br>
      </div>
   

    <!--课程信息-->
    <div style="padding: 15px; display: none;" class="students">
        <blockquote class="layui-elem-quote layui-text">
         学生信息管理
        </blockquote>
        
        <div class="layui-card layui-panel">
            <table class="layui-table">
              <colgroup>
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <thead>
                    <th>序号</th>
                    <th>学生姓名</th>
                    <th>班级</th>
                    <th>专业</th>
                    <th>学院</th>
                    <th>课程名称</th>
                    <th>询问次数</th>
                    <th>记录时间</th>
                </thead>
                <tbody>
                  
                </tbody>
            </table>

        </div>
        <br><br>
      </div>
    </div>
   
     
   
    
    
    </div>
    <div class="layui-footer">

      底部固定区域
    </div>
  </div>
  <script src="../static/task.js"></script>
  <script src="../static/teacher/js/nav.js"></script>
  <script src="../static/teacher/js/teacher/main.js"></script>
  <script src="../static/teacher/js/students/main.js"></script>
  <script src="../static/index.js"></script>
 <script>
  
        // 使用刚指定的配置项和数据显示图表
!(async function(){
    let response=await taskObject.fetchtemplate(path='/api/teacher/getuniquenumber')
 
    var courses =Array();
    var data = Array();

    response.data.forEach(element => {
      courses.push(element.coursename)
      data.push(element.number)
    });
    
   
    var myChart = echarts.init(document.getElementById('coursenumber'));

    var option = {
        title: {
            text: '学生积极度分析图'
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        xAxis: {
            type: 'category',
            data: courses
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: data,
            type: 'bar',
            barWidth: '60%', // 柱形图宽度
            label: { // 显示数据
                show: true,
                position: 'top' // 数据显示在柱形图的顶部
            }
        }]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    
    // 添加鼠标移动事件，显示数据
    myChart.on('mouseover', function (params) {
        var dataIndex = params.dataIndex;
        var value = data[dataIndex];
        var course = courses[dataIndex];
        myChart.dispatchAction({
            type: 'showTip',
            seriesIndex: 0,
            dataIndex: dataIndex
        });
        
    });

    myChart.on('mouseout', function (params) {
        myChart.dispatchAction({
            type: 'hideTip'
        });
    });
}())
  </script>
  <script>
    layui.use(['element', 'layer', 'util'], function () {
      var element = layui.element;
      var layer = layui.layer;
      var util = layui.util;
      var $ = layui.$;
      util.event('lay-header-event', {
        menuLeft: function (othis) { // 左侧菜单事件
          layer.msg('展开左侧菜单的操作', { icon: 0 });
        },
        menuRight: function () {  // 右侧菜单事件
          layer.open({
            type: 1,
            title: '更多',
            content: '<div style="padding: 15px;">处理右侧面板的操作</div>',
            area: ['260px', '100%'],
            offset: 'rt', // 右上角
            anim: 'slideLeft', // 从右侧抽屉滑出
            shadeClose: true,
            scrollbar: false
          });
        }
      });
    });
 </script>
  <script>
    layui.use(['element', 'layer', 'util'], function () {
      var element = layui.element;
      var layer = layui.layer;
      var util = layui.util;
      var $ = layui.$;
      util.event('lay-header-event', {
        menuLeft: function (othis) { // 左侧菜单事件
          layer.msg('展开左侧菜单的操作', { icon: 0 });
        },
        menuRight: function () {  // 右侧菜单事件
          layer.open({
            type: 1,
            title: '更多',
            content: '<div style="padding: 15px;">处理右侧面板的操作</div>',
            area: ['260px', '100%'],
            offset: 'rt', // 右上角
            anim: 'slideLeft', // 从右侧抽屉滑出
            shadeClose: true,
            scrollbar: false
          });
        }
      });
    });
  </script>
</body>

</html>